﻿using BookTheBook.Data.Model;
using BookTheBook.Data.NameDefinitions;
using FluentNHibernate.Mapping;

namespace BookTheBook.Data.Mappings
{
    public class CopyMap : ClassMap<Copy>
    {
        public CopyMap()
        {
            Table(TableNames.Copy);
            Id(x => x.Id).Column(ColumnNames.CopyId);
            References(x => x.Book).Column(ColumnNames.BookId);
            HasOne(x => x.RentDetails).ForeignKey(ForeignKeyNames.RentDetailsToCopy).Cascade.All();
        }
    }
}
